<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class PlayerChangePwdRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'password_old' => 'required|min:5|max:15',
            'password' => 'required|min:6|max:15',
            'password2' => 'required|same:password',
        ];
    }

    public function messages()
    {
        return [
            'password_old.required'=>'旧密码必填',
            'password_old.min'=>'旧密码不少于 :min 位',
            'password_old.max'=>'旧密码最多 :max 位',

            'password.required'=>'新密码必填',
            'password.min'=>'新密码不能少于 :min 位',
            'password.max'=>'新密码最多 :max 位',
            'password2.required'=>'确认新密码必填',
            'password2.same'=>'2次输入的密码不一致',
        ];
        return parent::messages(); // TODO: Change the autogenerated stub
    }
}
